<?php

namespace App\Requests;

class UserRequest extends BaseFormRequest
{
    public function rules()
    {
        $request_key = $this->getRequestKey();
        if ($request_key === 'POST/api/user/register') {
            return [
                'phone' => 'required|string',
                'area_code' => 'required|string',
                'auth_code' => 'required|string'
            ];
        } else if ($request_key === 'POST/api/auth/me') {
            return [
                'username' => 'nullable|string',
                'gender' => 'nullable|int|in:0,1,2',
                'birthday' => 'nullable|date'
            ];
        } else if ($request_key === 'POST/api/user/change_avatar') {
            return [
                'avatar' => 'required|url'
            ];
        }
        return [];
    }
}